import javax.swing.JButton;
import javax.swing.JPanel;


import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import java.awt.CardLayout;
import javax.swing.border.TitledBorder;

public class ImportDataPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Create the panel.
	 */
	public ImportData_Stu P_stu;
	private JPanel P_room;
	public ImportDataPanel() {
		P_stu = new ImportData_Stu();
		P_room = new ImportData_Room();
		setBorder(new TitledBorder(null, "importData", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		setLayout(null);
		
		CardLayout card = new CardLayout();
		JPanel fixed_panel = new JPanel();
		fixed_panel.setBounds(10, 62, 492, 371);
		add(fixed_panel);
		fixed_panel.setLayout(card);
		fixed_panel.add("0",P_room);
		fixed_panel.add("1",P_stu);
		
		JButton button = new JButton("导入宿舍数据");
		button.setBounds(131, 29, 124, 23);
		add(button);
		
		JButton button_1 = new JButton("导入学生数据");
		button_1.setBounds(275, 29, 124, 23);
		add(button_1);
		
		button.setEnabled(false);
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				card.show(fixed_panel, "0");
				button.setEnabled(false);
				button_1.setEnabled(true);
			}
		});
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				card.show(fixed_panel, "1");
				P_stu.updateComboBox();
				button_1.setEnabled(false);
				button.setEnabled(true);
			}
		});
		
		
		
		

	}
}
